<extend name="Layout:layout_dialog" />
<block name="body_main">
    <form action="{:U('channel_edit_save')}" method="post" class="xsui-form">
        <fieldset>
            <div class="xsui-form-field">
                <label>栏位名称：</label>
                <input type="text" name="title" placeholder="栏位名称" required="required" value="{$data.title}"/>
            </div>
            <div class="xsui-form-field">
                <label>栏位位置：</label>
                <select name="pid" data-url="{:U('get_channel_tree_json')}" data-value="{$data.pid}"></select>
            </div>
            <div class="xsui-form-field xsui-form-field-vertical">
                <label>栏目类型：</label>
                <div class="xsui-radio-group-vertical" style="margin-left:70px; line-height:21px;">
                    <foreach name="atype_names" item="vo">
                        <input type="radio" name="type_name" value="{$vo.value}" data-value="{$data.type_name}" required="required" /> {$vo.text} <span>{$vo.comment}</span><br />
                    </foreach>
                </div>
            </div>
            <div class="xsui-form-field">
                <label>栏目代码：</label>
                <input type="text" name="code" placeholder="栏位代码" value="{$data.code}"/>
            </div>
            <div class="xsui-form-field">
                <label>前台显示：</label>
                <sohtml:radio name="status" items="1:显示;0:隐藏" value="{$data.status|default=1}" />
            </div>
        </fieldset>
        <input type="hidden" name="id" value="{$data.id}" />
        <input type="hidden" name="site_id" value="{$data.site_id}"/>
        <input type="hidden" name="user_name" value="{$data.user_name}"/>
        <button type="submit" class="ui-state-default"><i class="fa fa-save"></i>保存</button>
        <button type="reset" class="ui-state-default">重置</button>
    </form>  
</block>
<block name="body_after">
    <script>
        $(function () {
            ajax_combobox({selector: 'select[name="pid"]', def_option: '请选择位置'});
            // 2016-6-17 SoChishun Added.
            $('input[name="type_name"]').each(function () {
                var $this = $(this);
                if ($this.val() == $this.data('value')) {
                    $this.prop('checked', true);
                    return;
                }
            })
        })
    </script>
</block>